var t = require("../../utils/config"), e = require("../../utils/request"), a = require("../../utils/api"), o = require("../../utils/date"), n = require("../../utils/storage");

Page({
    data: {
        themeColor: getApp().globalData.themeColor,
        reservationList: [],
        qrCodeImgUrl: t.resourceRoot + "icon-qrcode.png",
        showQrCode: !1,
        reservationNo: "",
        qrCode: ""
    },
    onLoad: function() {
        this.getCurrentDayReservation();
    },
    getCurrentDayReservation: function() {
        var t = this;
        this.setData({
            reservationList: []
        });
        var n = o.formatDate(new Date(), "yyyy-MM-dd");
        e.request(e.HttpMethod.GET, a.apiRoute.getCurrentDayReservation + "?rDate=" + n, {}).then(function(e) {
            //lhd
            t.setData({
                reservationList: [
                    {"companyName":"companyName1","name":"name1","insName":"insName1","rtimeSpan":"rtimeSpan1"},
                    {"companyName":"companyName2","name":"name2","insName":"insName2","rtimeSpan":"rtimeSpan2"}
                ],
                showReservationList: !0
            });
            // e.success && e.data.length > 0 && t.setData({
            //     reservationList: e.data,
            //     showReservationList: !0
            // });
        });
    },
    goCheck: function(o) {
        var r = this;
        t.getH5ResvDetailUrl().then(function(t) {
            var i = n.getStorageSync(n.storageKey.uid), s = o.target.dataset.item.checkCardNo, c = !([ "CRS_BulkLd", "ZJ_OutSideInPut", "WEB_BulkResv", "PQ_Bulkld", "PQ_BulkLd", "KA_Family", "KA_WEB_BULK_RESV" ].indexOf(o.target.dataset.item.sourceValue) >= 0), u = o.target.dataset.item.resvPid || "", d = o.target.dataset.item.vip || "0", l = o.target.dataset.item.companyCode, g = o.target.dataset.item.ldNo, h = o.target.dataset.item.isVcard || !0, v = i || "", p = "cardNo=".concat(s, "&bindCard=").concat(c, "&isVIP=").concat(d, "&resvPid=").concat(u, "&companyID=").concat(l, "&ldNo=").concat(g, "&showButton=true&isVCard=").concat(h, "&source=wechatAppletNew&operator=").concat(v), f = t, C = n.getStorageSync(n.storageKey.locationInfo);
            null != C && null != C && "" != C && (p += "&pointY=".concat(C.latitude, "&pointX=").concat(C.longitude)), 
            console.log(p), e.request(e.HttpMethod.POST, a.apiRoute.encodeResvUrl, {
                urlpara: p
            }).then(function(t) {
                var e = "".concat(f, "&accesskey=").concat(t.url);
                wx.navigateTo({
                    url: "/pages/webview/webview?h5=".concat(encodeURIComponent(e)),
                    success: function() {
                        r.setData({
                            loading: !1
                        });
                    }
                });
            });
        });
    },
    createQrCode: function(t) {
        var o = this;
        console.log(88, t);
        var n = t.target.dataset.item.resvNo;
        this.setData({
            reservationNo: n
        }), e.request(e.HttpMethod.GET, a.apiRoute.createQrCode + "?text=".concat(n, "&width=300&height=300"), {}).then(function(t) {
            t.success && t.data.length > 0 && o.setData({
                qrCode: t.data,
                showQrCode: !0
            });
        });
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {
        this.getCurrentDayReservation();
    },
    onReachBottom: function() {},
    onShareAppMessage: function() {}
});